import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TemplateTaskVO, TemplateTaskForm, TemplateTaskQuery } from '@/api/advertisement/templateTask/types';

/**
 * 查询巨量项目广告任务记录列表
 * @param query
 * @returns {*}
 */

export const listTemplateTask = (query?: TemplateTaskQuery): AxiosPromise<TemplateTaskVO[]> => {
  return request({
    url: '/oce/templateTask/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询巨量项目广告任务记录详细
 * @param taskId
 */
export const getTemplateTask = (taskId: string | number): AxiosPromise<TemplateTaskVO> => {
  return request({
    url: '/oce/templateTask/' + taskId,
    method: 'get'
  });
};

/**
 * 新增巨量项目广告任务记录
 * @param data
 */
export const addTemplateTask = (data: TemplateTaskForm) => {
  return request({
    url: '/oce/templateTask',
    method: 'post',
    data: data
  });
};

/**
 * 修改巨量项目广告任务记录
 * @param data
 */
export const updateTemplateTask = (data: TemplateTaskForm) => {
  return request({
    url: '/oce/templateTask',
    method: 'put',
    data: data
  });
};

/**
 * 删除巨量项目广告任务记录
 * @param taskId
 */
export const delTemplateTask = (taskId: string | number | Array<string | number>) => {
  return request({
    url: '/oce/templateTask/' + taskId,
    method: 'delete'
  });
};
